<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="public/vite.svg" />
    <link rel="stylesheet" type="text/css" href="public/lib/cesium/Widgets/widgets.css">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>viewer</title>
    <style>
        html, body, .container {
            padding: 0;
            margin: 0;
            width: 100%;
            height: 100vh;
            overflow: hidden;
        }
    </style>
</head>
<body>
<div id="container" class="container"></div>
<script src="public/lib/cesium/Cesium.js"></script>
<script>
    Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiMzg3MDJjMS0xZjVmLTQzNDctYWQ0Mi1hZTQ5YWQ4YzI3MGIiLCJpZCI6MjMxODIsInNjb3BlcyI6WyJhc3IiLCJnYyJdLCJpYXQiOjE1ODI4NTI1ODN9.Ww7N7wFEUOIJWqSvAGruQT9PfSCv9RS2QwZq-Ebjws4';
    let options = {
        infoBox: false,
        animation: false,
        timeline: false,
        geocoder: false,
        baseLayerPicker: false,
        homeButton: false,
        sceneModePicker: false,
        navigationHelpButton: false,
        fullscreenButton: false,
        vrButton: false,
        selectionIndicator: false,
        shouldAnimate: true,
    }

    // const imgProvider = new Cesium.WebMapServiceImageryProvider({
    //     url : 'https://ahocevar.com/geoserver/wms',
    //     layers : 'ne:ne',
    //     parameters: {
    //         service: 'WMS',
    //         format: 'image/png',
    //         transparent: true
    //     }
    // })

    // const imgProvider = new Cesium.SingleTileImageryProvider({
    //     url: 'public/world.jpg'
    // })

    const imgProvider = new Cesium.UrlTemplateImageryProvider({
        url: 'https://webst0{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
        subdomains: ['1', '2', '3', '4']
    })

    options = {
        imageryProvider: imgProvider,
        ...options
    }
    const terrainProvider = new Cesium.CesiumTerrainProvider({
        url: 'http://localhost:8086/dem1',
        //请求水波纹效果
        requestWaterMask: true,
        //请求照明
        requestVertexNormals: true
    });

    options = {
        terrainProvider: terrainProvider,
        ...options
    }
    const viewer = new Cesium.Viewer('container', options);

    const lblImgProvider = new Cesium.UrlTemplateImageryProvider({
        url: 'http://wprd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&x={x}&y={y}&z={z}&scl=4&style=8&ltype=4',
        subdomains: ['1', '2', '3', '4']
    })
    viewer.scene.imageryLayers.addImageryProvider(lblImgProvider)

    //去cesium logo水印
    viewer.cesiumWidget.creditContainer.style.display = "none";
</script>
</body>
</html>
